/*
 * ===================================================================
 *  
 *      Filename:  log_client_queue.c
 *
 *   Description:  This file is used to work as an queue  :)
 *
 *       Version:  1.0
 *        Create:  2010/07/13
 *
 *        Author:  Keven Zhu     kevenzhu@tencent.com
 *     Copyright:  Reserved by Tencent.com Co.ltd
 *          
 * ====================================================================
 */
#ifndef __LOG_CLIENT_QUEUE__
#define __LOG_CLIENT_QUEUE__

#include "log_client_mutex_sem.h"

/* Return the used share buffer to the queue
 * @ctl_header: ctl header for the share memory, containing the header and tailer index
 * @data:address for the used memory which will be released to the queue
 * 
 * Return value:
 * positive means failure,the reason could be found in the header file or with plogerr()
 * 0 means OK*/
int enqueue(local_share_mem_ctl_header *local_ctl_header,char* data);


/* Dequeue the packet from the queue, if the queue is empty, a NULL point will be returned;
 * @ctl_header:ctl header for the share memory
 *  
 * Return value:
 * positive means OK
 * NULL means the queue is empty*/
void* dequeue(local_share_mem_ctl_header *local_ctl_header);

/*initialize the queue for the share memory*/
void init_queue(share_mem_ctl_header *ctl_header, int max_queue);

/*destroy the queue,nothing to do*/
void finit_queue(share_mem_ctl_header *ctl_header);

#endif

